import reshandler from 'services/response-handler'
import Vue from 'vue'
/*
 * 活动详情
 */
function makeData(response) {
    console.log(response)
    let val = response.post
    // let imgArr = []
    // val.images && val.images.forEach(img=>{
    //     imgArr.push(Vue.prototype.$.host + img)
    // })
    val.author['publishDate'] = val.publishDate
    val.author['hasFollow'] = val.hasFollow
    val.author['postType'] = val.postType
  return Object.assign({},response, {
        author:val.author,
        content:val.content,
        hasFollow:val.hasFollow,
        id:val.id,
        refId:val.refId,
        title:val.title,
        image:val.images[0]
  })
}
export default function (params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "QueryTopic",
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeData), reshandler.error(fail))
}
